/**
* Copyright (c) By zengqh.
*
* This program is just for fun or demo, in the hope that it  
* will be useful, you can redistribute it and/or modify freely.
*
* Time: 2013/03/09
* File: ProgramUniform.cpp
* Blog: http://www.cnblogs.com/zengqh/
**/

#include "OGLProgramUniform.h"
#include "OGL.h"

namespace HY
{
void OGLProgramUniform::set(int x)
{
	glUniform1i(uniform_loc, x);
}

void OGLProgramUniform::set(float x)
{
	glUniform1f(uniform_loc, x);
}

void OGLProgramUniform::set2(const int* x)
{
	glUniform2iv(uniform_loc, 1, x);
}

void OGLProgramUniform::set2(const float* x)
{
	glUniform2fv(uniform_loc, 1, x);
}

void OGLProgramUniform::set3(const int* x)
{
	glUniform3iv(uniform_loc, 1, x);
}

void OGLProgramUniform::set3(const float* x)
{
	glUniform3fv(uniform_loc, 1, x);
}

void OGLProgramUniform::set4(const int* x)
{
	glUniform4iv(uniform_loc, 1, x);
}

void OGLProgramUniform::set4(const float* x)
{
	glUniform4fv(uniform_loc, 1, x);
}

void OGLProgramUniform::set(const Matrix4& x)
{
	glUniformMatrix4fv(uniform_loc, 1, GL_FALSE, x.Transpose().Data());
}


void OGLProgramUniform::set(const Color& clr)
{
	set4(clr.Data());
}

void OGLProgramUniform::set(const Vector2& v)
{
	set2(v.Data());
}

void OGLProgramUniform::set(const Vector3& v)
{
	set3(v.Data());
}

void OGLProgramUniform::set(const Vector4& v)
{
	set4(v.Data());
}

}